package com.ashapo.pattern.pattern021nullobject;

//第4步
//使用CustomerFactory根据传递给它的客户名称获取RealCustomer或NullCustomer对象。

public class NullPatternDemo {

    /**
     * 空对象模式
     * @param args
     */
    public static void main(String[] args) {

        AbstractCustomer customer1 = CustomerFactory.getCustomer("Rob");
        AbstractCustomer customer2 = CustomerFactory.getCustomer("Bob");
        AbstractCustomer customer3 = CustomerFactory.getCustomer("Julie");
        AbstractCustomer customer4 = CustomerFactory.getCustomer("Laura");

        System.out.println("Customers");
        System.out.println(customer1.getName());
        System.out.println(customer2.getName());
        System.out.println(customer3.getName());
        System.out.println(customer4.getName());
    }
}
